home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_091 / include / adlrun.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  5KB  |  162 lines

  1. #include <setjmp.h>
  2.  
  3. #define SLEN    80        /* Maximum length of an input string    */
  4. #define NUMDO    10        /* Maximum # of direct objs allowed    */
  5. #define STACKSIZE 1024        /* Maximum stack depth            */
  6.  
  7. /* Structure of a macro definition */
  8. struct    macro {
  9.     char
  10.     name[ 10 ],        /* Name of the macro            */
  11.     val[ 80 ];        /* Replacement text of the macro    */
  12.     struct macro
  13.     *next;            /* Next macro in the stack        */
  14. };
  15.  
  16.  
  17. /* Structure of an actor */
  18. struct actrec {
  19.     int16
  20.     actor;            /* Object id of this actor        */
  21.     char
  22.     *linebuf,        /* Pointer to current input line    */
  23.     savebuf[ SLEN ];    /* Static save area for input line    */
  24.     int16
  25.     interact;        /* Get new string if null linebuf?    */
  26. #if MULTIPLEX
  27.     char
  28.     ttyname[ SLEN ];    /* Name of the actor's tty        */
  29.     FILE
  30.     *ttyfile;        /* Opened version of the same        */
  31. #endif
  32. };
  33.  
  34.  
  35. /* Structure of a $exit place */
  36. struct exit_place {
  37.     jmp_buf
  38.     exit_goto;        /* Where to go for ($exit n)        */
  39.     int16
  40.     exit_ok;        /* Is it OK to perform ($exit n)    */
  41. };
  42.  
  43. #if MSDOS & LATTICE
  44. #  define SET_EXIT(n) (exits[n].exit_ok=1, setjmp(&(exits[n].exit_goto)))
  45. #  define DO_EXIT(n)  (exits[n].exit_ok=0, longjmp(&(exits[n].exit_goto),1))
  46. #else
  47. #  define SET_EXIT(n) (exits[n].exit_ok=1, setjmp(exits[n].exit_goto))
  48. #  define DO_EXIT(n)  (exits[n].exit_ok=0, longjmp(exits[n].exit_goto,1))
  49. #endif
  50. #define CLR_EXIT(n)   (exits[n].exit_ok=0)
  51.  
  52. extern struct actrec
  53.     actlist[];            /* List of actors            */
  54.  
  55. extern address
  56.     ip;                /* Instruction pointer            */
  57. extern int16
  58.     stack[],            /* Execution stack            */
  59.     sp,                /* Stack pointer            */
  60.     bp,                /* Base pointer, or Frame pointer    */
  61.     numact,            /* Number of Actors in Actlist        */
  62.     curract,            /* Current Actor            */
  63.     Verb,            /* Current verb                */
  64.     Prep,            /* Current preposition            */
  65.     Iobj,            /* Current indirect object        */
  66.     Inoun,            /*   and its noun            */
  67.     Imod,            /*   and its modifier            */
  68.     Conj[],            /* List of conjunctions            */
  69.     Dobj[],            /* List of direct objects        */
  70.     Dnoun[],            /*   and their nouns            */
  71.     Dmod[],            /*   and their modifiers        */
  72.     NumDobj,            /* Number of direct objects        */
  73.     vecverb[],            /* Verb list                */
  74.     demons[],            /* List of active demons        */
  75.     fuses[],            /* List of active fuses            */
  76.     ftimes[],            /* When to activate fuses        */
  77.     f_actors[],            /* Actors associated with fuses        */
  78.     numd,            /* Number of active demons        */
  79.     numf,            /* Number of active fuses        */
  80.     currturn,            /* Current turn counter            */
  81.     prompter,            /* Prompting routine            */
  82.     numsave,            /* Number of "saved" characters        */
  83.     debug,            /* Print out debugging info?        */
  84.     header,            /* Should we print out header bar?    */
  85.     wordwrite,            /* Should we write unknown words?    */
  86.     restarted,            /* Is the game being restarted?        */
  87.     scrwidth,            /* Width of the screen            */
  88.     numcol,            /* How far we've written across        */
  89.     t_type,            /* Current token type            */
  90.     t_val,            /* Current token value            */
  91.     read_t,            /* TRUE iff lexer is to read next token    */
  92.     Phase;            /* Current phase #            */
  93.  
  94. extern struct exit_place
  95.     exits[];            /* List of exit places            */
  96.  
  97. extern char
  98.     *H_STR,            /* Header format string            */
  99.     *s,                /* Current token            */
  100.     *xp;            /* Macro expansion of s            */
  101.  
  102. extern FILE
  103.     *wordfile,            /* If so, write them to this file.    */
  104.     *scriptfile;        /* File for "scripting" output        */
  105.  
  106. #if MULTIPLEX
  107. extern FILE
  108.     *CURRTTY,            /* Current tty for output        */
  109.     *SYSTTY;            /* Default I/O tty            */
  110. #endif
  111.  
  112. extern char
  113.     savec[];            /* The saved string array        */
  114.  
  115. extern struct macro
  116.     *mactab;            /* Table of macro expansions        */
  117.  
  118. extern int16
  119.     bitpat[],            /* Bit patterns for masking        */
  120.     ibitpat[];            /* Bitwise NOT of above            */
  121.  
  122.  
  123.  
  124. #if DEBUG
  125. extern int16
  126.     pop();            /* Pop the top of the stack        */
  127. #else
  128. #    define push(x)    (stack[sp++]=x)
  129. #    define pop(x)    (stack[--sp])
  130. #    define assertargs(s,n) 0
  131. #endif
  132.  
  133. #define puship() push( ip )    /* Push the IP (in case of 32-bit)    */
  134. #define popip()    (ip = pop())    /* Pop the IP (in case of 32-bit)    */
  135.  
  136. #define    CURRACT        actlist[ curract ].actor
  137. #define PSTRING        actlist[ curract ].linebuf
  138. #define SAVEBUF        actlist[ curract ].savebuf
  139. #define INTERACT    actlist[ curract ].interact
  140.  
  141. #define    ARG( n )    stack[ bp + n ]    /* n'th argument to this rout    */
  142. #define    RETVAL        stack[ bp ]    /* Return val. from this rout    */
  143.  
  144. extern int16
  145.     noun_exists(),        /* Is [mod noun] a legal object?    */
  146.     yesno(),            /* Did the player type 'Y' or 'y'?    */
  147.     nummacro();            /* Returns number of macros defined    */
  148.  
  149. extern char
  150.     *malloc(),            /* Memory allocation            */
  151.     *findone(),            /* Find a symbol.            */
  152.     *expand();            /* Try to macro-expand a string        */
  153.  
  154. extern int16
  155.     lookup(),            /* Look up a token in the symbol table    */
  156.     insertkey();        /* Insert a token into the symbol table    */
  157.  
  158. extern int
  159.     parse();            /* Parse the player's sentence        */
  160.  
  161. /*** EOF adlrun.h ***/
  162.